package com.example.student_blocket;

import android.app.Activity;
import android.content.Intent;
//import android.content.SharedPreferences;
import android.media.MediaPlayer;
import android.os.Bundle;
//import android.preference.PreferenceManager;
import android.view.Window;
import android.view.WindowManager;

public class Splash extends Activity{

	MediaPlayer ourSong;
	boolean music = true;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.splash);
		ourSong = MediaPlayer.create(Splash.this, R.raw.startsound);
//		SharedPreferences getPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
//		boolean music = getPrefs.getBoolean("checkbox", true);
		if(music){
			ourSong.start();
		}
		
		Thread timer = new Thread(){
			@Override
			public void run(){
				try{
					sleep(3000);
				}catch (InterruptedException e){
					e.printStackTrace();
				}finally{
					Intent openStartingPoint = new Intent("android.intent.action.MAINACTIVITY");
					startActivity(openStartingPoint);
				}
			}
		};
		timer.start();
	}

	@Override
	protected void onPause() {
		super.onPause();
		ourSong.release();
		finish();
	}

	
	
	

}
